/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package makao;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

/**
 *
 * @author gekon
 */
public class InfoPanel extends JPanel
{
    private MakaoView makaoView = null;
    private Boolean paintableFlag = false;
    private Graphics2D graph2D;
    private ImageIcon tableIcon;
    private Image tableImage;
    private PlayerData playerData;

    @Override
    public void paintComponent(Graphics g)
    {
        graph2D = (Graphics2D) g;
        super.paintComponent(graph2D);

        if (paintableFlag)
        {
            setBackground();
            graph2D.drawImage(tableImage, 0, 0, this.getWidth(), this.getHeight(), this);
        }
    }

    public void setBackground()
    {
        tableIcon = new ImageIcon("src/images/infoPanelBackground.jpg");
        tableImage = tableIcon.getImage();
        this.repaint();
    }

    public void setPlayerData(PlayerData playerData, MakaoView makaoView)
    {
        this.makaoView = makaoView;
        this.playerData = playerData;
        paintableFlag = true;
    }
}
